/*
 * DOMParentProxy.java
 *
 * Created on September 4, 2006, 12:21 PM
 *
 * (C) 2006 R. Alexander Milowski
 */

package org.infoset.xml.dom;

import org.infoset.xml.Child;
import org.infoset.xml.Item;
import org.w3c.dom.DOMException;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

/**
 *
 * @author alex
 */
public abstract class DOMChildProxy extends DOMNodeProxy {
   
   /** Creates a new instance of DOMParentProxy */
   public DOMChildProxy(Item item,DOMDocumentProxy docProxy) {
      super(item,docProxy);
   }
   
   public boolean hasChildNodes() {
      return false;
   }
   
   public Node appendChild(Node n) {
      throw new DOMException(DOMException.NOT_SUPPORTED_ERR,"Appending children is not supported on node type "+getNodeType());
   }
   
   public Node removeChild(Node n) {
      throw new DOMException(DOMException.NOT_SUPPORTED_ERR,"Removing children is not supported on node type "+getNodeType());
   }
   
   public Node replaceChild(Node newChild,Node oldChild) {
      throw new DOMException(DOMException.NOT_SUPPORTED_ERR,"Replacing children is not supported on node type "+getNodeType());
   }
   
   public Node insertBefore(Node newChild,Node refChild) {
      throw new DOMException(DOMException.NOT_SUPPORTED_ERR,"Inserting children is not supported on node type "+getNodeType());
   }
   
   public boolean hasAttributes() {
      return false;
   }
   
   public NamedNodeMap getAttributes() {
      return null;
   }
   
   public void setPrefix(String value) {
   }
   
   public String getPrefix() {
      return null;
   }
   
   public Node getNextSibling() {
      return documentProxy.getProxy(((Child)item).getFollowingSibling());
   }
   public Node getPreviousSibling() {
      return documentProxy.getProxy(((Child)item).getPrecedingSibling());
   }
   
   public Node getFirstChild() {
      return null;
   }
   
   public Node getLastChild() {
      return null;
   }
   
   public NodeList getChildNodes() {
      return null;
   }
   
   public Node getParentNode() {
      Child c = (Child)item;
      return documentProxy.getProxy(c.getParent());
   }
}
